package main

import (
	"context"
	"log"
	"net"
)

var dnsServer string = ":8052"
var proxyServer string = ":8053"
var hostsFile string = "/etc/hosts"
var logLevel string = "fatal"

var proxyKey string = "PROXY_SERVER"
var dnsKey string = "DNS_SERVER"
var hostsFileKey string = "HOSTS_FILE"
var logLevelKey string = "LOG_LEVEL"

func main() {
	initConfig()
	log.Printf("日志级别:%s", logLevel)
	net.DefaultResolver = &net.Resolver{
		PreferGo: true,
		Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
			return net.Dial(network, dnsServer)
		},
	}
	go func() {
		startDNSServer()
	}()
	startProxyServer()
}
